import {   AfterContentInit,
  ChangeDetectorRef,
  Component,
  ElementRef,
  HostBinding,
  Input, NgZone, OnDestroy, OnInit,
  Renderer2,
  ViewChild } from '@angular/core';
  export type xmBtnType = 'primary' | 'warning' | 'danger' | 'default';
  export type xmTitle = String;
@Component({
  selector: 'xm-btn',
  templateUrl: './btn.component.html',
  styleUrls: ['./btn.component.css']
})
export class BtnComponent implements OnInit {
  private _type: xmBtnType;
  private _title:xmTitle;
  private el: HTMLElement;
  private title:String="btn1";
  @ViewChild('contentElement') contentElement: ElementRef;
  @Input()
  get xmTitle():xmTitle{
    return this._title;
  }
  set xmTitle(value:xmTitle){
    this._title = value;
    this.title = value;
  }
  @Input()
  get xmType(): xmBtnType {
    return this._type;
  }

  set xmType(value: xmBtnType) {
    this._type = value;
    this.setClass(value);
  }
  constructor(private elementRef: ElementRef,private renderer: Renderer2){
    this.el=this.elementRef.nativeElement;
    
  }
  ngOnInit() {
  
  }
  setClass(value){
    this.renderer.addClass(this.el.querySelector("button"),value);
  }
}
